<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="__PUBLIC__/resource/assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="__PUBLIC__/resource/assets/css/admin.css">
    <script src="//cdn.bootcss.com/vue/1.0.24/vue.min.js"></script>
    <style>
        .am-btn-default{background: none}
    </style>
</head>
<body>
<div class="am-cf admin-main2">
    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <ol class="am-breadcrumb">
                        <li><a href="{{ url('admin/index/center') }}" class="am-icon-home">后台首页</a></li>
                        <li class="am-active">内容</li>
                    </ol>
                </div>
                <div class="am-fr am-cr">
                    <a class="am-btn am-btn-warning hw-shuaxin" href="javascript:location.replace(location.href);" title="刷新">
                        <i class="am-icon-refresh"></i>
                    </a>
                    <a class="am-btn am-btn-secondary hw-shuaxin tianjia" v-on:click="addschool" title="添加">
                        <i class="am-icon-plus"></i>
                    </a>
                    <a class="am-btn am-btn-success hw-shuaxin tianjia" v-on:click="addlist" title="批量加载">
                        <i class="am-icon-paste"></i>
                    </a>
                </div>
            </div>
            <hr>

            <div class="am-g am-animation-slide-left">
                <form class="am-form" action="{:U('Member/index')}" method="get" id="form1">
                    <div class="am-u-sm-6 am-u-md-3" style="width: 100px !important;margin-right: 0px;padding-right: 0px;">
                        <div class="am-input-group am-input-group-sm">
                            <select  name="cid" class="am-form-field" id="doc-select-1" style="padding-right:30px;">
                                <option value="0">请选择会议</option>
                                <volist name="clist" id="vo">
                                    <eq name="vo.id" value="$where['cid']">
                                        <option value="{$vo.id}" selected>{$vo.name}</option>
                                        <else />
                                        <option value="{$vo.id}">{$vo.name}</option>
                                    </eq>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-2" style="float: left">
                        <div class="am-input-group am-input-group-sm">
                            <input type="text" class="am-form-field" name="company" placeholder="请输入公司名称" value="{$where.company}">
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-2" style="float: left">
                        <div class="am-input-group am-input-group-sm">
                            <input type="text" class="am-form-field" name="position" placeholder="请输入职位" value="{$where.position}">
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-2" style="float: left">
                        <div class="am-input-group am-input-group-sm">
                              <span class="am-input-group-btn">
                                    <button class="am-btn am-btn-default" type="submit">搜索</button>
                              </span>
                              <span class="am-input-group-btn">
                                    <button class="am-btn am-btn-default" type="submit" name="excel" value="1">导出Excel</button>
                              </span>
                        </div>
                    </div>

                </form>
            </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr>
                                <!--<th class="table-check"><input type="checkbox" /></th>-->
                                <th class="table-id">ID</th>
                                <th class="table-name">会议名</th>
                                <th class="table-address am-hide-sm-only">姓名</th>
                                <th class="table-banner">手机号</th>
                                <th class="table-logo">邮箱</th>
                                <th class="table-state">公司</th>
                                <th class="table-is_site">职位</th>
                                <th class="table-start_time">内设人员/现场报名</th>
                                <th class="table-end_time">是否到场</th>
                                <th class="table-set" width="150">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <template v-for="item in list">
                                <tr>
                                    <!--<td><input type="checkbox" /></td>-->
                                    <td>{{ $index+1 }}</td>
                                    <td>{{ item.cname }}</td>
                                    <td>{{ item.name }}</td>
                                    <td>{{ item.tel }}</td>
                                    <td>{{ item.email }}</td>
                                    <td>{{ item.company }}</td>
                                    <td>{{ item.position }}</td>
                                    <td>{{item.is_kind==1?'内设人员':'现场报名'}}</td>
                                    <td>{{item.is_arrive==1?'未到场':'到场'}}</td>
                                    <td>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <a class="am-btn am-btn-default am-btn-xs am-text-secondary" v-on:click.stop="edit(item.id)"><span class="am-icon-pencil-square-o"></span> 编辑</a>
                                                <a class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" v-on:click.stop="shanchu(item.id,this)"><span class="am-icon-trash-o"></span> 删除</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </template>
                            </tbody>
                        </table>
                        <div class="am-cf" style="padding:0px 30px 30px 30px;margin-bottom: 30px;">
                            <div class="am-fl hw-jilu">共 {{ list.length }} 条记录</div>
                            <div class="am-fr">
                                {$page}
                            </div>
                        </div>
                    </form>
                </div>

            </div>
        </div>
    </div>
    <!-- content end -->
</div>

<!--[if lt IE 9]>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="__PUBLIC__/resource/assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script src="//cdn.bootcss.com/jquery/2.0.2/jquery.min.js"></script>
<script src="__PUBLIC__/resource/layer/layer.js"></script>
<script src="__PUBLIC__/resource/assets/js/amazeui.min.js"></script>
<script src="__PUBLIC__/resource/assets/js/hw-layer.js"></script>
<script src="__PUBLIC__/resource/assets/js/app.js"></script>
<script>
    var vm = new Vue({
        el: 'body',
        data:{list:{$Data}},
        methods: {
            addschool: function (event) {
                layer_show("添加会议","{:U('Member/add')}",600,500)
            },
            addlist: function (event) {
                layer_show("批量添加参会人员","{:U('Member/addlist')}",600,300)
            },
            edit: function (id) {
                layer_show("编辑会议",'/admin/Member/edit/?id='+id,600,500)
            },
            download: function (event) {
                layer_show("批量添加参会人员","{:U('Member/download')}",600,300)
            },

            shanchu: function (id,event) {
                layer.msg('确定要删除吗？', {
                    time:0,
                    btn: ['确定', '取消'],
                    yes: function(){
                        $.get('/admin/Member/del/?id='+id,function (data) {
                            $temp = $.parseJSON(data);
                            if($temp['status'] == "200"){
                                vm.list.$remove(vm.list[event.$index])
                                layer.msg('删除成功！');
                            }else{
                                layer.msg($temp['text']);
                            }
                        })
                    }
                });
            },
        }
    })
    $("#download").click(function () {
        $.post("{:U('Member/download')}",$("#form1").serialize(),function (data) {
            $temp = $.parseJSON(data)
            if($temp['status'] == "200"){
                layer.msg($temp['text'],{icon:1,time:1000},function () {
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.location.reload()
                    parent.layer.close(index);
                })
            }else{
                layer.msg($temp['text'],{icon:2,time:1000});
            }
        })
    })

</script>
</body>
</html>